#!/usr/bin/evn python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   文件名称 :     __init__.py
   文件功能描述 :   功能描述
   创建人 :       小钟同学
   创建时间 :          2021/12/16
-------------------------------------------------
   修改描述-2021/12/16:         
-------------------------------------------------
"""



# import grpc



from grpcframe.zyxgrpc.base_middleware import BaseMiddlewareGrequestcontext
from typing import Any
from grpc_interceptor.exceptions import GrpcException
import grpc

from grpcframe.exts.grpclocal.request import Request
# 为了的到类型提示
from grpcframe.zyxgrpc.globals import grequestcontext
grequestcontext :Request= grequestcontext

# @app.add_middleware
class AuthMiddleware(BaseMiddlewareGrequestcontext):

    def before_handler(self):
        pass
        # 设置上下文信息处理
        print("我输出----没初始化吗？", grequestcontext.parse_request_metadata)
        print("我输---没初始化吗？AuthInterceptor")
        # 创建类似flask的上下文的对象
    def after_handler(self):
        pass

    def error_grpc_exc_handler(self,e:GrpcException):
        pass

    def finally_handler(self):
        pass